package logic

import (
	"context"
	"shoppings/shoprpc/shoprpc"

	"shoppings/api/internal/svc"
	"shoppings/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type LikeListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewLikeListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LikeListLogic {
	return &LikeListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *LikeListLogic) LikeList(req *types.LikeListRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	likelist, err := l.svcCtx.ShopRpc.LikeList(l.ctx, &shoprpc.LikeListRequest{})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Code:    "500",
			Data:    nil,
		}, nil
	}
	return &types.Response{
		Message: "排行榜成功",
		Code:    "200",
		Data:    likelist,
	}, nil
}
